
<!-- 资产信息管理 -->
<template>
    <div class="page">
        <div class="nuclein-query">
            <div>资产信息管理</div>
            <div style="margin-left: auto;">
            </div>
        </div>
        <div class="nuclein-query">
            <div>
                <el-input size="mini" width="200" v-model="keyword" placeholder="请输入小区名称" clearable></el-input>
            </div>
            <div style="margin-left: 10px;">
                <el-button size="mini" @click="gitList">查询</el-button>
            </div>
        </div>
        <div class="content-row">
            <el-table :data="tableData" style="width: 100%" border>
                <el-table-column prop="estateId" label="ID" sortable align="center">
                </el-table-column>
                <el-table-column prop="estateName" label="小区名称" align="center" width="140">
                </el-table-column>
                <el-table-column prop="province" label="省" align="center">
                </el-table-column>
                <el-table-column prop="city" label="市" align="center">
                </el-table-column>
                <el-table-column prop="area" label="区" align="center">
                </el-table-column>
                <el-table-column prop="areaDetail" label="详细地址" align="center" width="220">
                </el-table-column>
                <el-table-column prop="manager" label="管理区负责人" align="center">
                </el-table-column>
                <el-table-column prop="managePhone" label="管理处电话" align="center" width="140">
                </el-table-column>
                <el-table-column prop="showOpenAd" label="开门广告" align="center">
                    <template slot-scope="scope">
                        {{scope.row.showOpenAd == 1?'开启':'关闭'}}
                    </template>
                </el-table-column>
                <el-table-column prop="maxCard" label="租户可发卡数量" align="center">
                    <template slot-scope="scope">
                        {{scope.row.maxCard == 0?'无限制':scope.row.maxCard}}
                    </template>
                </el-table-column>
                <el-table-column prop="createTime" label="创建时间" align="center" width="160">
                </el-table-column>
                <!-- <el-table-column label="操作" width="180" align="center">
                    <template slot-scope="scope">
                        <el-button @click="handleEdit(scope.row)">编辑</el-button>
                        <el-button type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                    </template>
                </el-table-column> -->
            </el-table>
        </div>
        <!-- 分页 -->
        <div class="pagination">
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"
                :page-sizes="[10, 20, 30, 40]" :page-size="limit" layout="total, sizes, prev, pager, next, jumper"
                :total="total">
            </el-pagination>
        </div>
    </div>
</template>

<script>
import { estateList } from '../../api/api'
import commonFunction from '../../utils/commonFunction'
export default {

  data () {
    return {
      total: 10,
      page: 1,
      limit: 10,
      tableData: [],
      keyword: '', // 搜索
      sidx: '', // 升序 降序 名称
      order: ''// 升序 降序
    }
  },
  created () {
    this.gitList()
  },
  methods: {
    // 获取
    gitList () {
      const data = {
        _search: false,
        nd: '',
        limit: this.limit,
        page: this.page,
        sidx: this.sidx,
        order: this.order,
        keyword: this.keyword,
        _: ''
      }
      estateList({ ...data }).then(res => {
        if (res.code == 0) {
          const { totalCount, list } = res.page
          this.tableData = list.map(item => {
            const createTime = commonFunction.getTimeFormat(+new Date(item.createDate), 'YYYY-MM-DD hh:mm:ss')
            return {
              ...item,
              createTime
            }
          })
          this.total = totalCount
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    // 编辑
    handleEdit (row) {
      this.dialogFormVisible = true
      this.ruleForm = {
        assetsId: row.assetsId,
        ...row
      }
    },
    // 分页
    handleSizeChange (val) {
      this.limit = val
      this.gitList()
    },
    handleCurrentChange (val) {
      this.page = val
      this.gitList()
    }
  }
}
</script>

<style scoped>
.page {
    position: relative;
    height: 100%;
}

.nuclein-query {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #DCDFE6;
}

.content-row {
    overflow: hidden;
}

/* 分页 */
.pagination {
    width: 100%;
    padding: 20px;
    border-top: 1px solid #DCDFE6;
}
</style>
